﻿namespace NEvoWeb.Modules.NB_Store
{
    using DotNetNuke.Entities.Modules;
    using System;
    using System.Diagnostics;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class BaseModule : PortalModuleBase
    {
        public string StoreInstallPath;

        [DebuggerNonUserCode]
        public BaseModule()
        {
            base.Init += new EventHandler(this.Page_Init);
        }

        private static void AddTextToHead(string TextToAdd, Page Page)
        {
            if ((TextToAdd != "") && (Page.FindControl("NBStoreHeader") == null))
            {
                HtmlMeta child = new HtmlMeta {
                    ID = "NBStoreHeader"
                };
                child.Attributes["content"] = "nbstore";
                Control control2 = Page.FindControl("Head");
                Literal literal = new Literal {
                    Text = TextToAdd
                };
                if (control2 != null)
                {
                    control2.Controls.Add(child);
                    control2.Controls.Add(literal);
                }
            }
        }

        private void Page_Init(object sender, EventArgs e)
        {
            this.StoreInstallPath = this.ControlPath;
            AddTextToHead(SharedFunctions.GetStoreSettingText(this.PortalId, "pageheader.template", SharedFunctions.GetCurrentCulture(), false, true), this.Page);
        }
    }
}

